<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Person(name) {
            this.name = name
        }

        Person.prototype.showname = function() {
            return `名字是：${this.name}`
        };

        //子类
        function Student(name, skill) {
            Person.call(this, name); // 继承父类属性
            this.skill = skill;
        };

        Student.prototype = new Person(); // 继承父级的方法

        let stu1 = new Student('小名', '逃学');

        console.log(stu1.name);
        console.log(stu1.showname());
    </script>
</body>

</html>